﻿using Microsoft.Office.PowerPoint.STAMP.Core;
using NUnit.Framework;

namespace Microsoft.Office.PowerPoint.STAMP.Test
{
    [TestFixture]
    public class FontSizeCalculatorTest
    {
        [Test()]
        [TestCase(0.0f, 3.99f, 30)]
        [TestCase(4.0f, 4.99f, 12)]
        [TestCase(6.0f, 6.99f, 18)]
        [TestCase(7.0f, 8.49f, 21)]
        [TestCase(8.5f, 9.74f, 26)]
        [TestCase(9.75f, 12, 30)]
        public void FontSizeRuleTableLessThanFour(float min, float max, float expectedSize)
        {
            CheckSingle(min, expectedSize);
            CheckSingle(min + 0.1f, expectedSize);
            CheckSingle(max - 0.1f, expectedSize);
            CheckSingle(max, expectedSize);
        }

        private static void CheckSingle(float value, float expectedSize)
        {
            Length fontSize = new FontSizeCalculator(new Inch(value).ToPixels()).GetFontSize();
            Assert.AreEqual(expectedSize, fontSize, string.Format("Width: {0}\"", value));
        }
    }
}